package com.heima.admin.controller.v1;


import com.heima.admin.service.AdminChannelService;
import com.heima.model.admin.dtos.ChannelDto;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.pojos.WmChannel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/channel")
public class AdminChannelController {


    @Autowired
    private AdminChannelService adminChannelService;




    /**
     * 频道保存功能
     *
     * @param
     * @return
     */
    @PostMapping("/save")
    public ResponseResult saveChannel(@RequestBody WmChannel wmChannel) {
        return adminChannelService.saveChannel(wmChannel);
    }


    /**
     * 频道查询功能
     *
     * @param dto
     * @return
     */
    @PostMapping("/list")
    public ResponseResult selectChannels(@RequestBody ChannelDto dto) {
        return adminChannelService.selectChannels(dto);
    }

    /**
     * 频道删除功能
     *
     * @param id
     * @return
     */
    @GetMapping("/del/{id}")
    public ResponseResult deleteChannel(@PathVariable Integer id) {
        return adminChannelService.deleteChannel(id);
    }

    /**
     * 频道修改功能
     *
     * @param
     * @return
     */
    @PostMapping("/update")
    public ResponseResult updateChannel(@RequestBody WmChannel wmChannel) {
        return adminChannelService.updateChannel(wmChannel);
    }





}
